local CSGuildWarSeasonInfo = class("CSGuildWarSeasonInfo")
local UserBaseInfo = import(".UserBaseInfo")


function CSGuildWarSeasonInfo:ctor()
    self._guildName = ""
    self._guildId = ""
    self._serverIndex = 0
    self._rank = 0
    self._leader = nil
end

function CSGuildWarSeasonInfo:read(pbData)
    if not pbData then
        return
    end
    local guildData = rawget(pbData, "info")
    if guildData then
        self._guildName = rawget(guildData, "name") or ""
        self._guildId = rawget(guildData, "uuid") or ""
        self._serverIndex = rawget(guildData, "server") or 0
    end
    local leaderData = rawget(pbData, "leader")
    if leaderData then
        self._leader = UserBaseInfo.new()
        self._leader:read(leaderData)
    else
        self._leader = nil
    end
    self._rank = rawget(pbData, "rank") or 0
end



function CSGuildWarSeasonInfo:getGuildName()
    return self._guildName
end

function CSGuildWarSeasonInfo:getServerName()
    return app.channelAPI:getServerNameByIndex(self._serverIndex)
end

function CSGuildWarSeasonInfo:getGuildId()
    return self._guildId
end

function CSGuildWarSeasonInfo:getRank()
    return self._rank
end


function CSGuildWarSeasonInfo:getLeader()
    return self._leader
end


return CSGuildWarSeasonInfo